/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.feiyue.basic.server.dl;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.widget.RemoteViews;

public class DlService extends Service {
	private Context context;
	private NotificationManager manager;

	public IBinder onBind(Intent paramIntent) {
		return null;
	}

	public void onCreate() {
		this.context = getApplicationContext();
		this.manager = ((NotificationManager) getSystemService("notification"));
		super.onCreate();
	}

	public void onDestroy() {
		super.onDestroy();
	}

	public int onStartCommand(Intent paramIntent, int paramInt1, int paramInt2) {
		Bundle localBundle = paramIntent.getExtras();
		if (localBundle == null)
			return super.onStartCommand(paramIntent, paramInt1, paramInt2);
		int i = localBundle.getInt("categoryid");
		int j = localBundle.getInt("bookid");
		String str1 = localBundle.getString("bookname");
		String str2 = localBundle.getString("issuestate");
		PendingIntent localPendingIntent = PendingIntent.getActivity(this, 0,
				new Intent(), 0);
		Notification localNotification = new Notification();
		localNotification.icon = 2130837551;
		localNotification.tickerText = "开始为您下载" + str1;
		localNotification.contentView = new RemoteViews(getPackageName(),
				2130903069);
		localNotification.contentView.setTextViewText(2131099848, str1
				+ " 已下载完成" + "0%");
		localNotification.contentIntent = localPendingIntent;
		localNotification.flags = 16;
		this.manager.notify(j, localNotification);
		DlRunnable localDlRunnable = new DlRunnable(localNotification,
				this.manager, this.context, str1, j);
		Handler localHandler = new Handler();
		new Thread2Dl(this.context, localDlRunnable, localHandler, i, j, str2)
				.start();
		return super.onStartCommand(paramIntent, paramInt1, paramInt2);
	}
}